//
//  DPWalletAccountInfoCell.swift
//  DoctorEPlus
//
//  Created by 王林波 on 2021/3/19.
//

import UIKit

class DPWalletAccountInfoCell: UITableViewCell {
    var unbindActBlock:(() -> Void)?
    

    @IBOutlet weak var headerIconImageView: UIImageView!
    @IBOutlet weak var account_label: UILabel!
    @IBOutlet weak var unbindBtn: UIButton!
    @IBOutlet weak var name_traling: NSLayoutConstraint!
    
    var model: DPWalletAlipayInfoModel! {
        didSet {
            if model.alipayUserId.isEmpty == true { // 没有账号
                self.unbindBtn.isHidden = true
                self.account_label.text = "暂未绑定账户"
                self.headerIconImageView.isHidden = true
                self.name_traling.constant =  -40
            }else {
                self.unbindBtn.isHidden = false
                self.account_label.text = model.alipayNickName
                self.headerIconImageView.isHidden = false
                self.headerIconImageView.sd_setImage(with: URL.init(string: model.alipayAvatar), completed: nil)
                self.name_traling.constant =  2
            }
        }
    }
    
    
    @IBAction func unbindAct(_ sender: UIButton) {
        self.unbindActBlock?()
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        self.headerIconImageView.addLayerCorner(15, 0, .white)
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
